<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>盛筑OA系统</title>
    <script src="../static/kaige/js/szload.js"></script>
    <link rel="stylesheet" href="../static/kaige/css/welcome.css">
</head>

<body>
    <div class="kaige-body">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-xs10 layui-col-sm10 layui-col-md10">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md9">
                        <div class="layui-carousel" id="test10">
                            <div carousel-item="">
                                <div style="width: 100%; height: 100%">
                                    <img src="../static/img/oa-ban1.jpg" style="width: 100%; height: 100%">
                                </div>
                                <div style="width: 100%; height: 100%">
                                    <img src="../static/img/oa-ban2.jpg" style="width: 100%; height: 100%">
                                </div>
                                <div style="width: 100%; height: 100%">
                                    <img src="../static/img/oa-ban3.jpg" style="width: 100%; height: 100%">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10" style="margin-top: 10px;">
                            <div class="layui-col-md6">
                                <div class="layui-card">
                                    <div class="layui-card-header">
                                        <i class="fa fa-wpforms"></i> 我的申请
                                        <span class="fa fa-bars lch-more" id="more_myshenqing" title="更多"></span>
                                    </div>
                                    <div class="layui-card-body" style="min-height:210px">
                                        <ul class="k-ul" id="myshenqing"></ul>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="layui-card">
                                    <div class="layui-card-header">
                                        <i class="fa fa-bullhorn"></i> 通知公告
                                        <span class="fa fa-bars lch-more" id="more_tab_item1" title="更多"></span>
                                    </div>
                                    <div class="layui-card-body" style="min-height:210px">
                                        <ul class="k-ul" id="home_announcement"></ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-inline" id="test-n1" style="width: calc(20vW);"></div>
                    </div>
                </div>

                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md9">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md6">
                                <div class="layui-card">
                                    <div class="layui-card-header">
                                        <i class="fa fa-newspaper-o"></i> 新闻资讯
                                        <span class="fa fa-bars lch-more" id="more_tab_item2" title="更多"></span>
                                    </div>
                                    <div class="layui-card-body">
                                        <ul class="k-ul" id="home_news"></ul>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="grid-demo grid-demo-bg1"
                                    style="position:absolute; z-index:999;width:calc(67.3vW);top:6px;left:6px; border:1px solid transparent;">
                                    <div class="layui-carousel" id="test11">
                                        <div carousel-item="">
                                            <div style="width: 100%; height: 100%">
                                                <img src="../static/img/oa-2ban1.jpg" style="width: 100%; height: 100%">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- <div class="layui-col-md3">

                </div> -->
                </div>
            </div>
            <div class="layui-col-xs2 layui-col-sm2 layui-col-md2">
                <div class="layui-row">
                    <div class="layui-col-md12">
                        <div class="tqbg">
                            <!--https://widget.qweather.com/-->
                            <div id="he-plugin-standard"></div>
                            <script>
                                WIDGET = {
                                    "CONFIG": {
                                        "layout": "2",
                                        "width": 230,
                                        "height": 265,
                                        "background": "5",
                                        "dataColor": "FFFFFF",
                                        "key": "f82c91cb2ef64ed0a1cc2408412a37f6"
                                    }
                                }
                            </script>
                            <script
                                src="https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0"></script>
                        </div>
                    </div>
                    <div class="layui-col-md12" style="margin-top:10px ;">
                        <div class="layui-card">
                            <div class="layui-card-header"><i class="fa fa-pie-chart"></i> 我的考勤
                                <span class="fa fa-bars lch-more" title="更多"></span>
                            </div>
                            <div class="layui-card-body">
                                <div style="width:230px;margin-left: -10px;">
                                    <canvas id="canvas"></canvas>
                                </div>
                                <div class="layui-btn-container" style="width: 230px; margin-top:10px">
                                    <button type="button" class="layui-btn layui-bg-green">上班签到</button>
                                    <button type="button" class="layui-btn layui-bg-orange">下班签退</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        load_init_js([
            szoapcpath + '/static/lib/chartjs/Chart.bundle.js',
            szoapcpath + '/static/lib/chartjs/utils.js',
        ], function () {
            layui.config({
                base: szoapcpath + '/static/kaige/layuiextend/'
            }).use(['layer', 'carousel', 'form', 'laydate', 'slider', 'apptpl', 'kaige', 'element'], function () {
                var carousel = layui.carousel
                    , laydate = layui.laydate
                    , slider = layui.slider
                    , apptpl = layui.apptpl
                    , element = layui.element
                    , layer = layui.layer
                    , form = layui.form;
                var timeteims, miao = 180;
                var welload = layer.load(0);
                window.pagedict = top.window.kaige_page.dict || {};

                //图片轮播
                carousel.render({
                    elem: '#test10'
                    , width: '100%'
                    , height: '225px'
                    , interval: 5000
                });
                carousel.render({
                    elem: '#test11'
                    , width: '100%'
                    , height: '360px'
                    , interval: 5000
                });

                $.get('/xzm.schedule/homelist', function (rd) {
                    if (rd && rd.status) {
                        var dhtml = '<hr><div style="width:240px;height:235px;overflow: hidden;padding:10px;"><ul class="layui-timeline">';
                        var ddd = rd.data && rd.data.data ? rd.data.data : null;
                        var countddd = 0;
                        if (ddd) {
                            for (var i = 0; i < ddd.length; i++) {
                                dhtml += '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis">&#xe63f;</i>';
                                dhtml += '<div class="layui-timeline-content layui-text">';
                                dhtml += '<div class="layui-timeline-title"><span class="layui-badge layui-bg-blue">' + dateFormat("MM-dd hh:mm", new Date(ddd[i].schedule_time * 1000)) + '</span></div>';
                                dhtml += '<p title="' + ddd[i].title + '">' + ddd[i].title.substring(0, 15) + '</p>';
                                dhtml += '</div></li>';
                                countddd++;
                            }
                        }
                        dhtml += '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis">&#xe63f;</i>';
                        dhtml += '<div class="layui-timeline-content layui-text"><div class="layui-timeline-title">';
                        if (countddd < 0) {
                            dhtml += '<span class="layui-badge layui-bg-gray">无数据</span>';
                        } else {
                            dhtml += '<span class="layui-badge layui-bg-blue" id="more_Schedule" style="cursor: pointer;">更多</span>';
                        }
                        dhtml += '</div></div></li>';
                        dhtml += '</ul></div>';
                        laydate.render({
                            elem: '#test-n1'
                            , position: 'static'
                            , showBottom: false
                            , ready: function (date) {
                                $("#test-n1").find('.layui-laydate-static').append(dhtml);
                            }
                        });

                        $('#more_Schedule').on('click', function (ev) {
                            parent.layui.oawin.addTabs({
                                id: '10_17_37_1',
                                title: '日程列表',
                                icon: 'fa fa-file-text-o',
                                url: (szoa.client.path || '') + '/pages/xzm/schedule/index.html'
                            });
                        });

                    }else{
                        var dhtml = '<hr><div style="width:240px;height:235px;overflow: hidden;padding:10px;"><ul class="layui-timeline">';
                       
                        dhtml += '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis">&#xe63f;</i>';
                        dhtml += '<div class="layui-timeline-content layui-text"><div class="layui-timeline-title">';
                        dhtml += '<span class="layui-badge layui-bg-gray">无数据</span>';
                        dhtml += '</div></div></li>';
                        dhtml += '</ul></div>';
                        laydate.render({
                            elem: '#test-n1'
                            , position: 'static'
                            , showBottom: false
                            , ready: function (date) {
                                $("#test-n1").find('.layui-laydate-static').append(dhtml);
                            }
                        });
                    }
                });


                //图表start
                var chartData = {
                    labels: ['迟到', '请假', '外出', '出差', '早退'],
                    datasets: [{
                        type: 'bar',
                        label: '次数',
                        backgroundColor: window.chartColors.blue,
                        data: [1, 5, 12, 9, 3],
                        borderWidth: 0
                    }]

                };

                var ctx = document.getElementById('canvas').getContext('2d');
                window.myMixedChart = new Chart(ctx, {
                    type: 'bar',
                    data: chartData,
                    options: {
                        indexAxis: 'y',
                        responsive: true,
                        title: { display: false, text: '我的考勤' },
                        tooltips: { mode: 'index', intersect: false }
                    }
                });
                //图表end

                //取数据
                $.ajax({
                    url: '/index/welcomelist',
                    success: function (res) {
                        if (res.status) {
                            var vd = res.data;

                            //我的申请
                            apptpl.viewTpl({
                                tpl: '#ulliTpl',
                                data: vd.myshenqing,
                                el: '#myshenqing',
                                callback: function (d) {
                                    $('#myshenqing >li').each(function (index, elem) {
                                        $(elem).on('click', function (e) {
                                            var url = $(elem).attr('data-url');
                                            layui.kaige.open({
                                                id: 'kaige',
                                                url: url,
                                                title: '<i class="fa fa-eye"></i> 查看',
                                            });
                                        });
                                    });
                                    //id:10_12_13,url:/pages/pmm/flow_bill/myshenqing.html,title:我的申请,opentype:2,maxopen:0,icon:
                                    $('#more_myshenqing').on('click', function (ev) {
                                        parent.layui.oawin.addTabs({
                                            id: '10_12_13',
                                            title: '我的申请',
                                            icon: 'fa fa-black-tie',
                                            url: (szoa.client.path || '') + '/pages/pmm/flow_bill/myshenqing.html'
                                        });
                                    });
                                }
                            });

                            //通知公告
                            apptpl.viewTpl({
                                data: vd.announcement
                                , tpl: '#announcementTpl'
                                , el: '#home_announcement'
                                , callback: function (d) {
                                    $('#home_announcement >li').each(function (index, elem) {
                                        $(elem).on('click', function (e) {
                                            var url = $(elem).attr('data-url');
                                            layui.kaige.open({
                                                id: 'kaige',
                                                url: url,
                                                title: '<i class="fa fa-eye"></i> 查看',
                                            });
                                        });
                                    });

                                    //id:10_17_16_1,url:/pages/xzm/announcement/index.html,title:通知公告,opentype:2,maxopen:0,icon:fa fa-list-alt
                                    $('#more_tab_item1').on('click', function (ev) {
                                        parent.layui.oawin.addTabs({
                                            id: '10_17_16_1',
                                            title: '通知公告',
                                            icon: 'fa fa-list-alt',
                                            url: (szoa.client.path || '') + '/pages/xzm/announcement/index.html'
                                        });
                                    });
                                }
                            });

                            //新闻资讯
                            apptpl.viewTpl({
                                data: vd.homenews
                                , tpl: '#home_newsTpl'
                                , el: '#home_news'
                                , callback: function (d) {
                                    $('#home_news >li').each(function (index, elem) {
                                        $(elem).on('click', function (e) {
                                            var url = $(elem).attr('data-url');
                                            layui.kaige.open({
                                                id: 'kaige',
                                                url: url,
                                                title: '<i class="fa fa-eye"></i> 查看',
                                            });
                                        });
                                    });
                                    //id:10_17_16_12,url:/pages/xzm/news/index.html,title:新闻资讯,opentype:2,maxopen:0,icon:fa fa-newspaper-o
                                    $('#more_tab_item2').on('click', function (ev) {
                                        parent.layui.oawin.addTabs({
                                            id: '10_17_16_12',
                                            title: '新闻资讯',
                                            icon: 'fa fa-list-alt',
                                            url: (szoa.client.path || '') + '/pages/xzm/news/index.html'
                                        });
                                    });
                                }
                            });

                            // layer.close(welload);
                        }
                        layer.close(welload);
                    }
                });

            });
        });
    </script>
    <script type="text/html" id="chaosongmyTpl">
        {{# layui.each(d.data, function(index, item){ var arrtable=item.cs_table.split('_'); }}
        <li data-url="{{ szoapcpath + '/pages/pmm/flow_bill/look.html?mdu=' + arrtable[0] + '&mdn=' + item.table.replace(arrtable[0]+'_','') + '&md=' + item.cs_modu_id + '&m_id=' + item.cs_m_id + '&formpage=welcome' }}">
            <span>【{{ item.glbill.modu_name }}】摘要：{{ item.glbill.flow_brief}},{{  pagedict.status_td[item.glbill.status] }}</span>
            <span>{{ item.glbill.put_name }}</span>
            <span>{{ item.glbill.put_time ? dateFormat("MM-dd", new Date(item.glbill.put_time)) : '' }}</span>
        </li>
        {{# }) }}
    </script>
    <script type="text/html" id="announcementTpl">
        {{# layui.each(d.data, function(index, item){ var arrtable=item.table.split('_'); }}
        <li data-url="{{ szoapcpath + '/pages/pmm/flow_bill/look.html?mdu=' + arrtable[0] + '&mdn=' + item.table.replace(arrtable[0]+'_','') + '&md=' + item.modu_id + '&m_id=' + item.id + '&formpage=welcome' }}" style="height: 35px;">
            <span><i class="layui-badge layui-bg-blue">{{ pagedict.Message_Type[item.gong_type] }}</i> {{ item.title}}  {{- (item.is_read && item.is_read ==1) ? '': '<i class="layui-badge-dot righttop"></i>'}}</span>
            <span>{{ item.put_name }}</span>
            <span>{{ item.put_time ? dateFormat("MM-dd", new Date(item.put_time)) : '' }}</span>
        </li>
        {{# }) }}
    </script>
    <script type="text/html" id="home_newsTpl">
        {{# layui.each(d.data, function(index, item){ var arrtable=item.table.split('_'); }}
        <li data-url="{{ szoapcpath + '/pages/pmm/flow_bill/look.html?mdu=' + arrtable[0] + '&mdn=' + item.table.replace(arrtable[0]+'_','') + '&md=' + item.modu_id + '&m_id=' + item.id + '&formpage=welcome' }}" style="height: 35px;">
            <span><i class="layui-badge layui-bg-blue">{{ pagedict.News_Type[item.news_type] }}</i> {{ item.title}} {{- (item.is_read && item.is_read ==1) ? '': '<i class="layui-badge-dot righttop"></i>'}} </span>
            <span>{{ item.put_name }}</span>
            <span>{{ item.put_time ? dateFormat("MM-dd", new Date(item.put_time)) : '' }}</span>
        </li>
        {{# }) }}
    </script>
    <script type="text/html" id="ulliTpl">
        {{# layui.each(d.data, function(index, item){ var arrtable=item.table.split('_'); }}
        <li data-url="{{ szoapcpath + '/pages/pmm/flow_bill/look.html?mdu=' + arrtable[0] + '&mdn=' + item.table.replace(arrtable[0]+'_','') + '&md=' + item.modu_id + '&m_id=' + item.id + '&formpage=welcome' }}">
            <span>【{{ item.modu_name }}】摘要：{{ item.flow_brief}},{{ item.now_audit_name }}:{{  pagedict.status_td[item.status] }}</span>
            <span>{{ item.put_name }}</span>
            <span>{{ item.put_time ? dateFormat("MM-dd", new Date(item.put_time)) : '' }}</span>
        </li>
        {{# }) }}
    </script>
    <script type="text/html" id="entryTpl">
        {{#  layui.each(d, function(index, item){ }}
        <li class="layui-col-xs2" data-id="{{ item.menu_id }}" data-url="{{ item.url }}" data-icon="{{ item.icon }}" data-title="{{ item.name }}" >
            <div class="kaige-entry-btn">
                <i class="{{ item.icon }}"></i>
                <p class="layui-elip">{{ item.name }}</p>
                {{# if(item.badge){ }}<span class="layui-badge" id="{{ item.badge }}"></span>{{# } }}
            </div>
        </li>
        {{# }) }}
    </script>
</body>

</html>